<%--
  Created by IntelliJ IDEA.
  User: liuxuebing
  Date: 2018/10/8
  Time: 21:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/meta.jsp"%>
<html>
<script type="text/javascript" src="${ctx}/static/js/jquery.B.js"></script>
<script type="text/javascript" src="${ctx}/static/js/jquery-A.js"></script>
<head>
    <title>电子结算中心-工资发放系统</title>
</head>
<body >
<form id="loginForm">
    <img src="${ctx}/static/images/login.jpg"
         width="900" height="200"
         vspace="20" hspace="210"/>
    <br><br><br><br>
    <div style="text-align: center">
        用户:<input  type="text" name="username" />
    </div><br>
    <div style="text-align: center">
        密码:<input type="password" name="password"/>
    </div><br>

    <div style="text-align: center;color: red "  id="errorMes"></div>

   <!-- <div style="float: left;text-align: center">
        <input type="button" id="submit" value="登陆"></div>
    <div style="float: left;text-align: center">
        <input type="button" id="" value="取消"></div>-->

    <div style=" text-align:center;margin-top:20px">
        <input  type="button" id="submit" value="登录" style="margin-right:10px; padding:5px 15px;  border-radius:3px;"/>
        <input  type="button" value="取消" style="padding:5px 15px; border-radius:3px;"/>
    </div>
</form>

</body>
<script type="text/javascript">
    $("#submit").click(function(){
        $.post("${ctx}/login",$("#loginForm").serialize(),function (data) {
            if (data.success == 'true') {
                window.location.href = "${ctx}/";
            }else {
                $("#errorMes").html(data.message);
            }

        });
    });
    $("body").keydown(function() {
        if (event.keyCode == "13") {//keyCode=13是回车键
            $('#submit').click();
        }
    });

</script>
</html>
